<% @totalTime = Trace.getTotalTraceTime %>

<% @totalTimeToday = 0 %>
<% Trace.getTodaysTraces.each do |traceFromToday| %>
<% @totalTimeToday += traceFromToday.minSpent %>
<% end %>
<% @totalTimeTodayHours = ((((@totalTimeToday.to_f/60)*100).round).to_f/100) %>
<% @todayPercent = ((@totalTimeToday/(AppConfig.hours_per_day*60).to_f)*100).round %>

<% @dayStart = @totalTimeToday.minutes.ago.to_time %>
<h3><center>Statistics</center></h3>
<ul>
<li>Total Time Today: <%= "%02d:%02d" % [(@totalTimeToday / 60),(@totalTimeToday % 60)] %></li>
<li>Current Time: <%= "%02d:%02d" % [Time.now.hour,Time.now.min] %></li>
<li>Day Start: <%= "%02d:%02d" % [@dayStart.hour, @dayStart.min] %></li>
<li>Today's Total: <%= @todayPercent %>%</li>
<%= progress_bar @todayPercent, :width => '100%' %>
<li>Total Events: <%= Event.find(:all).size %></li>
<li>Total Traces: <%= Trace.find(:all).size %></li>
<li>Total Hours Logged: <%= "%02d:%02d" % [(@totalTime / 60),(@totalTime % 60)] %></li>
</ul>
